<template>
  <div style="width:100vw;" class="teacher-box">
    <div class="record-header">
      <!-- 返回按钮 -->
      <!-- <mt-header fixed title="导师详情">
        <router-link to="/StudyCenter" slot="left">
          <mt-button class="back-butt" icon="back"></mt-button>
        </router-link>
      </mt-header> -->
    </div>
    <div class="teacher-head">
      <div class="teacher-card">
        <div class="flex-row teacher-card-top">
          <div>
            <p class="teacher-name">{{teacherList.username}}</p>
            <p class="teacher-ms">{{teacherList.deptName}}</p>
            <p class="teacher-mss">
              <span>{{teacherList.job}}</span>
              <span class="teacher-type">导师版</span>
            </p>
          </div>
          <div :style="`background-image:url(${teacherList.photo || require('@/assets/homePicture/userpicture.png')});`" class="teacher-picture">
            <!-- <img src="@/assets/homePicture/userpicture.png" alt=""> -->
          </div>
        </div>
      </div>
    </div>
    <div class="deliver"></div>
    <div class="teacher-detail">
      <div class="teacher-tips">讲师简介</div>
      <div class="teacher-detail-item flex-row">
        <div class="teacher-partment">
          <span class="iconfont iconweb-icon-" style="color: rgb(71, 135, 228); margin-right: 5px;"></span>
          <span>部门</span>
        </div>
        <div class="teacher-partment-name">{{teacherList.deptName || '暂无'}}</div>
      </div>
      <div class="teacher-detail-item flex-row">
        <div class="teacher-partment">
          <span class="iconfont iconqiwangzhiwei" style="color: rgb(71, 135, 228); margin-right: 5px;"></span>
          <span>岗位</span>
        </div>
        <div class="teacher-partment-name">{{teacherList.job || '暂无'}}</div>
      </div>
      <div class="teacher-detail-item flex-row">
        <div class="teacher-partment">
          <span class="iconfont iconxueli" style="color: rgb(71, 135, 228); margin-right: 5px;"></span>
          <span>学历</span>
        </div>
        <div class="teacher-partment-name">{{teacherList.edu || '暂无'}}</div>
        <!-- 0大专 1本科 2硕士 3博士  -->
      </div>
      <div class="teacher-detail-item flex-row">
        <div class="teacher-partment">
          <span class="iconfont iconlingdaitie2" style="color: rgb(71, 135, 228); margin-right: 5px;"></span>
          <span>专业</span>
        </div>
        <div class="teacher-partment-name">{{teacherList.major || '暂无'}}</div>
      </div>
      <div style="margin-bottom:0;" class="teacher-detail-item flex-row">
        <div class="teacher-partment">
          <span class="iconfont iconxingming" style="color: rgb(71, 135, 228); margin-right: 5px;"></span>
          <span>职称</span>
        </div>
        <div class="teacher-partment-name">{{teacherList.jobTitle || '暂无'}}</div>
      </div>
    </div>
    <div v-show="needShow" class="btn-group">
      <mt-button @click.native="confirm()" type="primary" size="large">一键申请</mt-button>
    </div>
    <!-- <div class="teacher-comment">
      <div class="teacher-comment-tips">评论区</div>
      <div class="teacher-comment-item">
        <div class="comment-top flex-row">
          <div class="comment-picture"></div>
          <div class="comment-content">
            <p class="comment-name">大傻吊</p>
            <p class="comment-type">初级工程师</p>
            <p class="comment-text">老师讲解的真的很详细呀！给老师点赞！</p>
          </div>
        </div>
        <div class="comment-time">5分钟前</div>
      </div>
    </div>-->
    <!-- <div class="deliver"></div> -->
  </div>
</template>
<script>
import { Indicator, MessageBox, Toast } from "mint-ui";
export default {
  data() {
    return {
      teacherList: {},
      needShow:true
    };
  },
  mounted() {
    let that = this;
    let {id , status} = this.$route.query;
    let params = {
      id
    };
    if(!status){
      this.needShow = false;
    }
    this.$get("qryUserInfoById", params).then(res => {
      if (res.success) {
        for(var key in res.data){
          if(key == 'edu'){
            if(res.data[key] == 0){
              res.data[key] = '大专'
            }else if(res.data[key] == 1){
              res.data[key] = '本科'
            }else if(res.data[key] == 2){
              res.data[key] = '硕士'
            }else if(res.data[key] == 3){
              res.data[key] = '博士'
            }else{
              res.data[key] = '其它'
            }
          }
        }
        this.teacherList = res.data;
      }
    });
  },
  methods: {
    confirm() {
      let id = this.teacherList.id;
      let params = {
        teaId:id
      }
      let that = this;
      that.$get("applayTea", params).then(res => {
        if (res.success) {
          Toast({
            message: "操作成功",
            iconClass: "mint-toast-icon mintui mintui-success",
            duration: 2000
          });
          setTimeout(() => {
            that.$router.go(-1);
          }, 2000);
        }
      });
    }
  }
};
</script>
<style lang="less" scoped>
@import url("~@/pagecss/myteacher.less");
.btn-group {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 23/75rem 30/75rem;
  background-color: #ffffff;
}
.btn-group button {
  flex: 1 0 auto;
}
</style>